using System;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Reflection;

namespace Charisma
{
    [DebuggerDisplay("{MappingName}")]
    public class RepositoryConfiguration
    {
        public RepositoryConfiguration(PropertyInfo property, EntityConfiguration root)
            : this(root)
        {
            Contract.Requires(property != null);
            Contract.Requires(root != null);

            Property = property;
            Name = property.Name;
        }

        public RepositoryConfiguration(EntityConfiguration root)
        {
            Contract.Requires(root != null);

            RootElement = root;
        }

        public string Name { get; set; }

        public PropertyInfo Property { get; set; }

        public EntityConfiguration RootElement { get; private set; }

        public KeyGeneratorKind KeyGeneratorKind { get; set; }
    }
}